package 多线程初阶.示例测试;

/**
 * 观察标志位是否清除
 */
public class TestDemo6 {
    private static class MyRunnable implements Runnable {
        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.interrupted());
            }
        }
    }
    public static void main(String[] args) {
        MyRunnable target=new MyRunnable();
        Thread thread=new Thread(target);
        thread.start();
        thread.interrupt();//按下按钮,回弹
    }
}
